Skip to content

Add tests for search_central_via_connection with search_path=None#707

Merged
JoeZiminski merged 2 commits into
fix_none_central_path_errorfrom
copilot/sub-pr-706
Mar 17, 2026
Merged

Add tests for search_central_via_connection with search_path=None#707
JoeZiminski merged 2 commits into
fix_none_central_path_errorfrom
copilot/sub-pr-706

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 17, 2026

The search_path=None code path in search_central_via_connection (used when cfg["central_path"] is None for Google Drive) had no test coverage, risking silent regressions.

Changes

  • New parametrized test test_search_central_none_search_path in tests/tests_integration/test_search_methods.py:
    • Mocks call_rclone_for_central_connection to return a fake directory listing
    • Asserts search_path=None doesn't raise
    • Asserts return_full_path=True returns Path objects (e.g. Path("sub-001")) rather than bare strings
    • Asserts return_full_path=False returns plain strings
    • Asserts exactly one rclone call is made
@pytest.mark.parametrize("return_full_path", [True, False])
def test_search_central_none_search_path(self, project, monkeypatch, return_full_path):
    # Simulates the Google Drive case where central_path is None
    folders, files = search_central_via_connection(
        project.cfg, None, "*", return_full_path=return_full_path
    )
    if return_full_path:
        assert all(isinstance(f, Path) for f in folders)  # Path("sub-001"), not "sub-001"
    else:
        assert all(isinstance(f, str) for f in folders)

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Co-authored-by: JoeZiminski <55797454+JoeZiminski@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on handling None case in search path fix Add tests for search_central_via_connection with search_path=None Mar 17, 2026
Copilot AI requested a review from JoeZiminski March 17, 2026 18:38
@JoeZiminski JoeZiminski marked this pull request as ready for review March 17, 2026 18:40
@JoeZiminski JoeZiminski merged commit d27d7fe into fix_none_central_path_error Mar 17, 2026
3 checks passed
JoeZiminski added a commit that referenced this pull request Mar 17, 2026
* Fix search path `None` case.

* Fix issues.

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Improve error diagnostics for `search_central_via_connection` when `search_path` is `None` (#708)

* Initial plan

* Move display_search_path into if block with rclone remote name for None case

Co-authored-by: JoeZiminski <55797454+JoeZiminski@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JoeZiminski <55797454+JoeZiminski@users.noreply.github.com>

* Add tests for `search_central_via_connection` with `search_path=None` (#707)

* Initial plan

* Add test for search_central_via_connection with search_path=None

Co-authored-by: JoeZiminski <55797454+JoeZiminski@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JoeZiminski <55797454+JoeZiminski@users.noreply.github.com>

* Revert AI nonsense.

* Small tidy up.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants